$(document).ready(function(){
    $(".yasearch").each(function() {
        var input = $(this);
        var parameters = {
            minChars: 2,
            cacheLength: 5,
            maxItemsToShow: 20,
            extraParams: {}
        };
        parameters.extraParams.field_id = input.attr("id");
        parameters.extraParams.method = "autocomplete";
        parameters.onItemSelect = function(){input.closest("form").submit()};
        input.autocomplete(".", parameters);
    });      
});
